package com.piece.blog.controller;

import com.piece.blog.dto.TrainingCourseDTO;
import com.piece.blog.service.TrainingCourseService;
import com.piece.core.framework.support.response.AjaxResponse;
import com.piece.core.web.controller.FrameWorkController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@Api(tags = {"课程前台管理"})
@RequestMapping("/public/course")
public class CourseFrontController extends FrameWorkController {

    @Resource
    private TrainingCourseService trainingCourseService;

    @PostMapping("/info/{id}")
    @ApiOperation(value = "查询课程数据")
    @ApiImplicitParam(name="id", value = "课程主键", type="path")
    public AjaxResponse info(@PathVariable long id) {
        TrainingCourseDTO course = trainingCourseService.queryCourseInfo(id);
        return success(course);
    }
}
